/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package thienphuc.patient.dao.impl;

import java.util.List;
import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.Restrictions;
import thienphuc.patient.dao.AbstractHibernateDaoSupport;
import thienphuc.patient.dao.DichVuDAO;
import thienphuc.patient.dto.DichVu;
import thienphuc.patient.dto.LoaiDichVu;

/**
 *
 * @author QuocDat
 */
public class DichVuDAOImpl extends AbstractHibernateDaoSupport<DichVu, Integer> implements DichVuDAO {

    public DichVuDAOImpl(Class<DichVu> classPersistent) {
        super(classPersistent);
    }

    public List<DichVu> findByTenDichVu(String tenDichVu) throws Exception {
        Criterion criterionTenDichVu = Restrictions.like(DICH_VU_TEN_DICH_VU, "%" + tenDichVu + "%");
        return this.findByCriteria(criterionTenDichVu);
    }

    public List<DichVu> findByLoaiDichVu(LoaiDichVu loaiDichVu) throws Exception {
        return this.findByProperty(DICH_VU_LOAI_DICH_VU, loaiDichVu);
    }
}
